#!/bin/bash

list="wlist.txt"
k=$2
files=$(ls ${1}/)

for file in $files 
do
    input="${1}/${file}"
    echo ""	
    
    bef=`grep "$file" $list`

    time1=$(date)
    echo ${time1}
    echo "timeout 14400 ../../../KDefective -r ${input} -O solve -a MADEC -p -D Set -k ${k} -t 10800"

    if [ -n "$bef" ]
    then 
        echo "Wrong before !!!"
    else 
        timeout 14400 ../../../KDefective -r ${input} -O solve -a MADEC -p -D Set -k ${k} -t 10800
    fi
done
